<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html  xmlns="http://www.w3.org/1999/xhtml"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:rich="http://richfaces.org/rich"
       xmlns:a4j="http://richfaces.org/a4j"
       xmlns:f="http://java.sun.com/jsf/core">
    <head>
        <title>TODO supply a title</title>
    </head>
    <body>
        <ui:composition>
            <h:form> 
                <rich:panel header="预算清单" styleClass="content-hight">
                    <h:panelGrid id="firstGroup" style="text-align:left" columns="2">

                        <h:outputLabel value="部门：" rendered="#{loginInfo.per.role eq 'A'}"/>
                        <h:selectOneMenu value="#{viewBean.deptCode}"
                                         rendered="#{loginInfo.per.role eq 'A'}"
                                         style="width:130px;">
                            <f:selectItem itemValue="" itemLabel="-请选择-"/>
                            <f:selectItems value="#{viewBean.deptli}"/>
                        </h:selectOneMenu>

                        <h:outputLabel value="年度："/>
                        <h:selectOneMenu value="#{viewBean.iyear}"
                                         style="width:130px;text-align: left">
                            <f:selectItem itemValue="" itemLabel="-请选择-"/>
                            <f:selectItems value="#{viewBean.yearli}"/>
                        </h:selectOneMenu>

                        <h:outputLabel value="资金性质："/>
                        <h:selectOneMenu value="#{viewBean.quality}"
                                         style="width:130px;">
                            <f:selectItem itemValue="" itemLabel="-请选择-"/>
                            <f:selectItem itemValue="0" itemLabel="基本支出"/>
                            <f:selectItem itemValue="1" itemLabel="项目支出"/>
                        </h:selectOneMenu>

                        <h:outputLabel value="新增/追加："/>
                        <h:selectOneMenu value="#{viewBean.addSign}"
                                         style="width:130px;">
                            <f:selectItem itemValue="" itemLabel="-请选择-"/>
                            <f:selectItem itemValue="0" itemLabel="新增"/>
                            <f:selectItem itemValue="1" itemLabel="追加"/>
                        </h:selectOneMenu>
                    </h:panelGrid>

                    <a4j:commandButton id="button" value="查询"
                                       action="#{viewBean.queryBudgetli}"
                                       onclick="this.disabled = 'true';"
                                       render="@this,tableGroup"
                                       execute="@form"/>
                    <hr/>
                    <h:panelGroup id="tableGroup">
                        <rich:dataScroller for="editTable"  execute="@this" render="tableGroup"/>
                        <div style="width:750px;min-height:200px;overflow:auto;">
                            <rich:dataTable id="editTable"
                                            value="#{viewBean.budgetViewList}" var="emp"
                                            rowClasses="list-row-odd,list-row-even"
                                            headerClass="table-header"
                                            noDataLabel="无数据!"
                                            rowKeyVar="rowKey"
                                            rows="10"
                                            style="width:1500px;margin-bottom: 5px;">
                                <rich:column style="width:30px;text-align: center">
                                    <f:facet name="header">序号</f:facet>
                                        #{rowKey+1}
                                </rich:column> 
                                <rich:column>
                                    <h:outputText value="新增" rendered="#{emp.addSign eq '0'}" style="color: green;"/>
                                    <h:outputText value="追加" rendered="#{emp.addSign eq '1'}" style="color: blue;"/>
                                </rich:column>                      
                                <rich:column>
                                    <f:facet name="header">类别</f:facet>
                                    <a4j:commandLink value="#{emp.planWay}" action="#{budgetEditGovBean.selected}" render="editGrid,tolbar,append"/>
                                </rich:column>
                                <rich:column rendered="#{budgetEditGovBean.quality =='1'}" >
                                    <f:facet name="header">项目</f:facet>
                                    <h:outputText value="#{emp.project.finName}"/>
                                </rich:column>
                                <rich:column style="width:100px;white-space: nowrap;">
                                    <f:facet name="header">部门</f:facet>
                                    <h:outputText value="#{emp.deptName}"/>
                                </rich:column>
                                <rich:column style="width:100px;white-space: nowrap;">
                                    <f:facet name="header">处室</f:facet>
                                    <h:outputText value="#{emp.officeName}"/>
                                </rich:column>
                                <rich:column style="width:100px;white-space: nowrap;">
                                    <f:facet name="header">编报人</f:facet>
                                    <h:outputText value="#{emp.editPerName}"/>
                                </rich:column>
                                <rich:column>
                                    <f:facet name="header">状态</f:facet>
                                    <h:outputText value="未提交"  rendered="#{emp.status == '0'}"/>
                                    <h:outputText value="已提交等待审核"  rendered="#{emp.status == '1'}" style="color:blue"/>
                                    <h:outputText value="审核通过"  rendered="#{emp.status == '3'}" style="color:green"/>
                                    <h:outputText value="退回修改"  rendered="#{emp.status == '2'}" style="color:red"/>
                                </rich:column>
                                <rich:column>
                                    <f:facet name="header">品目</f:facet>
                                    <h:outputText value="#{emp.cate.name}"/>
                                </rich:column>
                                <rich:column>
                                    <f:facet name="header">计量单位</f:facet>
                                    <h:outputText value="#{emp.cate.unit}"/>
                                </rich:column>
                                <rich:column>
                                    <f:facet name="header">采购数量</f:facet>
                                    <h:outputText value="#{emp.cate.count}"/>
                                </rich:column>
                                <rich:column style="text-align: right;width:120px">
                                    <f:facet name="header">财政性资金</f:facet>
                                    <h:outputText value="#{emp.financial}">
                                        <f:convertNumber type="number" pattern="#,##0.00"/>
                                    </h:outputText>
                                </rich:column>
                                <rich:column style="text-align:right;width:120px">
                                    <f:facet name="header">其他资金</f:facet>
                                    <h:outputText value="#{emp.other}">
                                        <f:convertNumber type="number" pattern="#,##0.00"/>
                                    </h:outputText>
                                </rich:column>
                                <rich:column>
                                    <f:facet name="header">组织形式</f:facet>                                
                                    <h:outputText value="集中采购" rendered="#{emp.organizeForm == '0'}"/>
                                    <h:outputText value="部门集中采购" rendered="#{emp.organizeForm == '1'}"/>
                                    <h:outputText value="分散采购" rendered="#{emp.organizeForm == '2'}"/>
                                </rich:column>
                                <rich:column>
                                    <f:facet name="header">委托的集中采购机构</f:facet>
                                    <h:outputText value="#{emp.organ}"/>
                                </rich:column>
                                <rich:column>
                                    <f:facet name="header">采购方式</f:facet>                                
                                    <h:outputText value="公开招标" rendered="#{emp.cateWay == '0'}"/>
                                    <h:outputText value="邀请招标" rendered="#{emp.cateWay == '1'}"/>
                                    <h:outputText value="竞争性谈判" rendered="#{emp.cateWay == '2'}"/>
                                    <h:outputText value="单一来源" rendered="#{emp.cateWay == '3'}"/>
                                    <h:outputText value="询价" rendered="#{emp.cateWay == '4'}"/>
                                </rich:column>
                                <rich:column>
                                    <f:facet name="header">备注</f:facet>
                                    <h:outputText value="#{emp.memo}"/>
                                </rich:column>
                                <rich:column style="width:80px;text-align:center">
                                    <f:facet name="header">操作</f:facet>
                                    <a4j:commandLink action="#{showFlowInfoBean.showFlowInfo(emp.id,'1')}"
                                                     oncomplete="#{rich:component('checkInfoPanel')}.show();"
                                                     render="infoPanel">
                                        <h:outputText value="审批信息"/>
                                    </a4j:commandLink>
                                </rich:column>
                                <f:facet name="footer"/>
                            </rich:dataTable>
                        </div>
                    </h:panelGroup>
                </rich:panel>
            </h:form>
            
            <rich:popupPanel id="checkInfoPanel" autosized="true" width="500" height="500">
                <f:facet name="header">审批信息</f:facet>
                <f:facet name="controls">
                    <h:outputLink value="#" onclick="#{rich:component('checkInfoPanel')}.hide();
                                               return false;">关闭</h:outputLink>
                </f:facet>
                <h:form>
                    <rich:panel id="infoPanel">
                        <ui:include src="/page/checkflow/checkInfo.xhtml"/>
                    </rich:panel>
                </h:form>
            </rich:popupPanel>
        </ui:composition>
    </body>
</html>
